package com.qf.mybatisplus.websocket;

import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;

import java.net.URI;
import java.net.URISyntaxException;

public class MyWebSocketClient extends WebSocketClient {

    public MyWebSocketClient(URI serverUri) {
        super(serverUri);
    }

    @Override
    public void onOpen(ServerHandshake serverHandshake) {

        System.err.println("连接成功");
    }

    @Override
    public void onMessage(String s) {

    }

    @Override
    public void onClose(int i, String s, boolean b) {

    }

    @Override
    public void onError(Exception e) {

    }

    public static void main(String[] args) throws URISyntaxException {
//        URI.create("ws://127.0.0.1:9000/websocket/ocr/10033")
        URI uri = new URI("ws://127.0.0.1:9000/websocket/ocr/10033");
        MyWebSocketClient myWebSocketClient = new MyWebSocketClient(uri);
        myWebSocketClient.send("54");


    }
}
